package com.gold.web;


import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.gold.service.RepertoryService;
import com.gold.util.BaseController;
import com.gold.util.GridPage;

import com.gold.util.Page;



@Controller
@RequestMapping(value="repertory")
public class RepertoryContorller extends BaseController{

    @Resource
    private RepertoryService repertoryService;
    
    @RequestMapping(value="")
    public ModelAndView toRepertoryVIew(HttpServletRequest request) {
		ModelAndView mo=new ModelAndView();
		mo.setViewName("repertory");
		return mo;
	}
    
   //huilay 2016年2月21日15:14:15 加载表格内容
    @RequestMapping("/repertoryGrid")
	@ResponseBody
	public GridPage<Map> getGrid(HttpServletRequest request){
		int page=this.getParamInt(request, "page", 1);
		int rows=this.getParamInt(request, "pageSize", 10);
		Page<Map> rtPage=new Page<Map>();
        rtPage.setPageSize(rows);
        rtPage.setPageNo(page);
        rtPage=repertoryService.findByCondition(rtPage);
		return new GridPage<Map>(rtPage);
	}
}
